package org.sat4j.minisat.core;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

import org.apache.commons.io.FileUtils;

public class Main
{
	public static void main(String[] args) throws IOException
	{
		File file = new File(
				"D:\\JavaWorkspace\\InconsistencyDetector_ver2\\test\\org\\sat4j\\minisat\\core\\in.txt");
		@SuppressWarnings("unchecked")
		List<String> lines = FileUtils.readLines(file);

		ArrayList<List<Integer>> allNumber = new ArrayList<List<Integer>>();
		for (String line : lines)
		{
			ArrayList<Integer> lineList = new ArrayList<Integer>();
			allNumber.add(lineList);
			String[] numbers = line.split(" ");
			for (String number : numbers)
			{
				number = number.trim();
				if (number.length() == 0)
				{
					continue;
				}
				lineList.add(Integer.parseInt(number));
			}
		}
		System.out.println("=========================");

		HashSet<Integer> TRUEs = new HashSet<Integer>();
		HashSet<Integer> FALSEs = new HashSet<Integer>();

		TRUEs.addAll(Arrays.asList(new Integer[] { 15, 6, 14 }));
		FALSEs.addAll(Arrays.asList(new Integer[] { 7, 23, 55, 327, 359, 375,
				263, 295, 311, 231 }));
		// guess ones
		TRUEs.addAll(Arrays.asList(new Integer[] { 14 }));
		FALSEs.addAll(Arrays.asList(new Integer[] {13}));

		System.out.println("=========================");
		for (List<Integer> line : allNumber)
		{
			for (Integer i : line)
			{
				if (TRUEs.contains(Math.abs(i)))
				{
					if (i > 0)
					{
						System.out.print("T ");
					}
					else
					{
						System.out.print("F ");
					}
				}
				else if (FALSEs.contains(Math.abs(i)))
				{
					if (i > 0)
					{
						System.out.print("F ");
					}
					else
					{
						System.out.print("T ");
					}
				}
				else
				{
					System.out.print(i + " ");
				}
			}
			System.out.println();
		}
	}
}
